import java.util.Random;
import java.util.Scanner;

public class test8 {
    /*模拟双色球
    需求:
    1.随机生成中奖号码
    2.用户输入中奖号码
    3.判断中奖情况
     */
    public static void main(String[] args) {
        int[] red=new int[33];
        int[] blue = new int[16];

        Random r = new Random();
        int[] arr1 = new int[67];
    //随机生成中奖号码
        for (int i = 0; i < 6; i++) {
            arr1[i]=r.nextInt(red.length);
        }
        arr1[6] = r.nextInt(blue.length);
    //输出中奖号码
        System.out.println("中奖号码为:");
        System.out.print("红球为:");
        for (int i = 0; i < 7; i++) {
            System.out.print(arr1[i]+" ");
            if(i == 5){
                System.out.print("\n蓝球为:");
            }
        }

    //用户输入中奖号码
        System.out.println("\n请输入您的号码:(先输入红球再输入蓝球)");
        Scanner sc = new Scanner(System.in);
        int[] arr2 = new int[7];
        for (int i = 0; i < arr2.length; i++) {
            if(i<6){
            System.out.println("请输入第"+(i+1)+"个号码");
            }else {
                System.out.println("蓝球为:");
            }
            arr2[i] = sc.nextInt();
            if(arr2[i]>33||arr2[i]<1){
                System.out.println("输入错误!请重新输入:");
                i = i-1;
            }
        }
    //判断是否中奖
    //红球
        int count1 = getPrice1(arr1,arr2);
    //蓝球
        int count2 = getPrice2(arr1,arr2);
    //判断中奖等级
        getLevel(count1,count2);
    }
    public static int getPrice1(int[] arr1,int[] arr2){
        int count1 = 0;
        for (int i = 0; i < 6; i++) {
            if(arr1[i]==arr2[i]) {
                count1++;
            }
        }
        return count1;
    }
    public static int getPrice2(int[] arr1,int[] arr2){
        int count2 = 0;
        if(arr1[6] == arr2[6]){
            count2++;
        }
        return count2;
    }

    public static void getLevel(int a,int b){
        if(a==6){
            if(b==1){
                System.out.println("恭喜您!获得了一等奖,奖金最高1000万元!");
            }else{
                System.out.println("恭喜您!获得了二等奖,奖金最高500万元!");
            }
        }else if(a==5){
            if(b==1){
                System.out.println("恭喜您!获得了三等奖,奖金为3000元!");
            }else{
                System.out.println("恭喜您!获得了四等奖,奖金为200元!");
            }
        }else if(a==4){
            if(b==1){
                System.out.println("恭喜您!获得了四等奖,奖金为200元!");
            }else{
                System.out.println("恭喜您!获得了五等奖,奖金为10元!");
            }
        }else if(a==3){
            if(b==1){
                System.out.println("恭喜您!获得了五等奖,奖金为10元!");
            }
        }else if (a==0&&b!=0){
            System.out.println("恭喜您!获得了六等奖,奖金为5元!");
        }else{
            System.out.println("很抱歉,您没有中奖!谢谢您的参与!");
        }
    }
}
